* Replication File for "Shifting Power, Commitment Problems, and Preventive War"
* Sam R. Bell and Jesse C. Johnson
* 10/24/14

use "BellJohnsonISQrep\BellJohnsonISQrepMonadic.dta", clear

* Table 1

	xtreg milcap leconpot lrivalry lbtdeaths lally lpolity2 lmilcap if year<=1914, i(ccode) fe
	xtreg milcap leconpot lrivalry lbtdeaths lally lpolity2 lmilcap if year<=1945, i(ccode) fe
	xtreg milcap leconpot lrivalry lbtdeaths lally lpolity2 lmilcap if year<=1990, i(ccode) fe
	xtreg milcap leconpot lrivalry lbtdeaths lally lpolity2 lmilcap if year<=2000, i(ccode) fe

exit

* Generating Expectations of Future Power

	capture drop future_power
	gen future_power=.
	label variable future_power "estimate of power at t+1"

	local a=1818
	while `a'<=2000 {
	
		xtreg milcap leconpot lrivalry lbtdeaths lally lpolity2 lmilcap if year<=`a', i(ccode) fe

		predict u, u
		bysort ccode: egen fe = max(u)
	
		gen x = _b[_cons] + _b[leconpot]*econpot + _b[lrivalry]*rivalry + _b[lbtdeaths]*btdeaths + _b[lally]*ally + _b[lpolity2]*polity2  + _b[lmilcap]*milcap + fe if year==`a'
	
		replace future_power = x if year==`a'
		replace future_power = 0 if future_power<0 & future_power~=.

		drop x u fe

	local a=`a'+1
	}
	
